{% extends 'xadmin/base.html' %}
{% load staticfiles %}

{% block title %}
    静态资源
{% endblock %}

{% block css %}
    <style>
        .site-doc-icon li .layui-icon {
            display: inline-block;
            font-size: 36px;
        }
        .layui-icon1{
            display: inline-block;
            font-size: 36px;
        }
        .site-doc-icon li{
            cursor: pointer;
        }
        .site-doc-icon li {
            display: inline-block;
            vertical-align: middle;
            width: 127px;
            height: 105px;
            line-height: 25px;
            padding: 20px 0;
            margin-right: -1px;
            margin-bottom: -1px;
            border: 1px solid #e2e2e2;
            font-size: 14px;
            text-align: center;
            color: #666;
            transition: all .3s;
            -webkit-transition: all .3s;
        }
    </style>
{% endblock %}

{% block main %}
    <div class="row">
            <div class="col-lg-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content" style="border-width:0px 0px">
                        <ul class="site-doc-icon" id="tree_list">
                            {% for doo in dlist %}
                                <li onclick="goto('{{ dirpath |default_if_none:"" }}', '{{ doo }}')">
                                    <i class="layui-icon1 fa fa-folder-open-o"></i>

                                    <div class="doc-icon-fontclass">{{ doo }}</div>
                                </li>
                            {% endfor %}
                            {% for foo in flist %}
                                <li onclick="openfile('{{ dirpath |default_if_none:"" }}', '{{ foo }}')">
                                    <i class="layui-icon layui-icon-file-b"></i>

                                    <div class="doc-icon-fontclass">{{ foo }}</div>
                                </li>
                            {% endfor %}



                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <div class="row">
            <div id="pagnitor" style="margin-left:40px;"></div>
        </div>
    </div>
{% endblock %}

{% block script %}
    <script>
        function goto(path, name){
            window.location.href='{% url "opendir" %}?path=' + path + '&name=' + name + '&siteid={{ siteid }}';
        }
        function openfile(path, name){
            window.location.href='{% url "openfile" %}?path=' + path + '&name=' + name + '&siteid={{ siteid }}';
        }

        var tree_list_len = $('#tree_list li').length;
        console.log(typeof(tree_list_len));
        if(tree_list_len == 0){
            $('#tree_list').html('<p style="text-align:center;">空空如也...</p>')
        }
    </script>
{% endblock %}
